package com.ctshk.sapp.order.bus.controller;


import javax.validation.Valid;

import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.order.bus.req.BusOrderRefundApprovalReq;
import com.ctshk.rpc.order.bus.service.IBusOrderRefundService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 巴士退款记录 前端控制器
 * </p>
 *
 * @author 彭柳霖
 * @since 2021-02-24
 */
@Api(value="订单中心-订单退款", tags="订单中心-订单退款")
@RestController
@RequestMapping("/bus-order-refund")
public class BusOrderRefundController extends BaseController {

    @DubboReference
    IBusOrderRefundService busOrderRefundService;


    @ApiOperation(value = "订单中心巴士票退款记录-删除", notes = "订单中心巴士票退款记录-删除")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.UPDATE, operTitle = "订单中心巴士票退款记录-删除", operDesc = "订单中心巴士票退款记录-删除")
    @GetMapping(value = "/delete/{refundId}")
    public Result delete(@PathVariable Long refundId){
        return busOrderRefundService.delete(refundId,getCurrentUser(getRequest()).getId());
    }
    
    @ApiOperation("巴士取消订单审批")
    @OperationLogAnnotation(operModul = OperationLogModel.ORDER, operType = OperationLogType.UPDATE, operTitle = "巴士取消订单审批", operDesc = "巴士取消订单审批")
    @PostMapping(value = "/refundApproval")
    public Result<Void> refundApproval(@RequestBody @Valid BusOrderRefundApprovalReq req) {
		return busOrderRefundService.refundApproval(req, getCurrentUser());
	}
}
